package com.csnf.controller;

import com.csnf.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/account")
public class AccountController {

    @Autowired
    AccountService accountService;

    //减余额
    @RequestMapping("/reduceAccount")
    public String  reduceAccount(String userId,Integer money){
        int r = accountService.reduceAccount(userId,money);

        if (r > 0){
            return "余额扣减成功";
        }else {
            return "余额扣减失败";
        }

    }

}
